package com.project.harmonyledger.controller.account;

import com.project.harmonyledger.common.response.Result;
import com.project.harmonyledger.dto.RegisterParams;
import com.project.harmonyledger.service.user.account.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/user")
public class RegisterController {
  @Autowired
  private RegisterService registerService;

  @PostMapping("/register")
  public Result<Map<String, String>> register(@RequestBody RegisterParams params) {
    return registerService.register(
        params.getUsername(),
        params.getPassword(),
        params.getConfirmedPassword());
  }
}
